<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<script type="text/javascript">
	//JavaScript对象构造方法
	function person(name,age){
		this.name=name;
		this.age=age;
		
		//可以把外部方法一起构造进去，js的特色
		function speak(sth){
			alert(sth);
		}
		this.func=speak;
	}
	var p=new person("jack",12);
	alert(p.name);
	alert(p.age);
	
	p.func("hello");
</script>
</body>
</html>